package com.gxuwz.medical.dao;
import com.gxuwz.medical.domain.area.Area;
import com.gxuwz.medical.domain.family.*;
import com.gxuwz.medical.domain.person.Person;

import java.sql.ResultSet;
import java.sql.SQLException;
/**
 * 家庭档案信息查询DAO类
 * @author 演示
 *
 */
public class FamilyDao extends GenericDao<Family> {

	@Override
	protected Family handle(ResultSet rs) throws SQLException {
		
		Family entity=new Family();
		entity.setFamicode(rs.getString("famicode"));
		entity.setTown(new Area(rs.getString("town")));
		entity.setVillage(new Area(rs.getString("village")));
		entity.setGroupNo(new Area(rs.getString("groupNo")));
		entity.setHousePro(rs.getString("housePro"));
		entity.setPopuNum(rs.getInt("popuNum"));
		entity.setAgriNum(rs.getInt("agriNum"));
		entity.setAddress(rs.getString("address"));
		entity.setCreattime(rs.getDate("creattime"));
		entity.setCreator(rs.getString("creator"));
		//根据户主农合证号
		Person holder=null;
		try{
			holder=new Person(rs.getString("perscode"));
		}catch(Exception e){
			e.printStackTrace();
		}
		entity.setHolder(holder);
		return entity;
	}

}
